Core.App = function() {
	this.stopArr = [];
	this.startArr = [];
	
	this.running = false;
};

Core.App.prototype = {
	
	__clear: function() {},

	/**
	 * Runs the application. 
	 * Starts all of the desired functionality.
	 */
	start: function() {
		this.running = true;
		Array.each(this.startArr, function(fn) { fn(); });
	},
	
	/**
	 * Shutdowns the application. 
	 * Stops all of the ongoing functionality.
	 */
	stop: function() {
		this.running = false;
		Array.each(this.stopArr, function(fn) { fn(); });
	},
	
	/**
	 * Returns true if the application is in loading mode.
	 */
	isLoading: function() {
		return !this.running;
	},
	
	/**
	 * Returns true if the application is running.
	 * That means that all of the loading is already done.
	 */
	isRunning: function() {
		return this.running;
	},
	
	/**
	 * Registers listener that will be triggered on Core.App.start().
	 */
	addStartListener: function(fn) {
		this.startArr.push(fn);
	},
	
	/**
	 * Registers listener that will be triggered on Core.App.stop().
	 */
	addStopListener: function(fn) {
		this.stopArr.push(fn);
	}
};

Core.App = Singleton.register("core.app", Core.App);